<?php

/**
 * form_sav form base class.
 *
 * @method form_sav getObject() Returns the current form's model object
 *
 * @package    e-DSL
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class Baseform_savForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'dossier_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('dossier'), 'add_empty' => true)),
      'date'             => new sfWidgetFormDate(),
      'fournisseur_id'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('fournisseur'), 'add_empty' => true)),
      'objet'            => new sfWidgetFormInputText(),
      'ref_chantier'     => new sfWidgetFormInputText(),
      'nro_arc'          => new sfWidgetFormInputText(),
      'action_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('action'), 'add_empty' => true)),
      'adresse_chantier' => new sfWidgetFormTextarea(),
      'commentaire'      => new sfWidgetFormTextarea(),
      'suivi_par'        => new sfWidgetFormInputText(),
      'tel_domicilie'    => new sfWidgetFormInputText(),
      'tel_travail'      => new sfWidgetFormInputText(),
      'tel_portable'     => new sfWidgetFormInputText(),
      'email'            => new sfWidgetFormInputText(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'dossier_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('dossier'), 'required' => false)),
      'date'             => new sfValidatorDate(),
      'fournisseur_id'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('fournisseur'), 'required' => false)),
      'objet'            => new sfValidatorString(array('max_length' => 255)),
      'ref_chantier'     => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'nro_arc'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'action_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('action'), 'required' => false)),
      'adresse_chantier' => new sfValidatorString(array('required' => false)),
      'commentaire'      => new sfValidatorString(),
      'suivi_par'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'tel_domicilie'    => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'tel_travail'      => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'tel_portable'     => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'email'            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'created_at'       => new sfValidatorDateTime(),
      'updated_at'       => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('form_sav[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'form_sav';
  }

}
